/* ========================================================================== */
/*   Health.h                    		                                      */
/*   (c) 2012 Team 7 Hogeschool Utrecht ICT TI                                */
/*		Lars Stolwijk, Gerben Boot, Guido van Hienen, Marcel Boelen			  */
/*                                                                            */
/*   Responsible for the players health, gives signal when health becomes	  */
/*	 zero or less.														      */
/* ========================================================================== */

#ifndef __Health
#define __Health

#include "pRTOS.h"
#include "GameHandler.h"
#include "ProcessHitController.h"
#include "Config.h"

class ProcessHitController;
class GameHandler;

class Health : public RTOS::task {
	public:	
		//Constructor
		Health(int prio, ProcessHitController * processHitController) : RTOS::task(prio, "HealthTask"), DecreaseAndGetHealthFlag(this, "DecreaseAndGetHealthFlag"), ResetHealthFlag(this, "ResetHealthFlag"), theProcessHitController(processHitController){}
		
		void DecreaseAndGetHealth();
		void ResetHealth();
		void RegisterGameHandler(GameHandler * gameHandler);
		signed char ReadHealth();
		
	private:
		RTOS::pool<char> HealthPool;
		RTOS::flag DecreaseAndGetHealthFlag, ResetHealthFlag;

		GameHandler * theGameHandler;
		ProcessHitController * theProcessHitController;

		signed char health;

		void main();
};

#endif
